package com.itheima.dao;

import com.itheima.domain.Account;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @program: Spring_day01_01_IOC入门程序
 * @description:
 * @author: xuejingjing
 * @create: 2021-08-03 20:11
 **/


@Component
public interface AccountDao {

    @Insert("insert into account(name,money) values(#{name},#{money})")
    void save(Account account);

    @Delete("delete from account where id=#{id}")
    void delete(Integer id);

    @Update("update account set name= #{name},money=#{money} where id =#{id}")
    void update(Account account);

    @Select("select *from account")
    List<Account> findAll();

    @Select("select *from account where id = #{id}")
    Account findById(Integer id);

}
